<template>
  <div class="head-container">
    <!-- 搜索 -->
    <el-form ref="queryForm" :inline="true"  size="small" label-width="80px">
      <el-form-item label="设备名称">
    <el-input v-model="query.deviceName" clearable placeholder="输入设备名称" style="width: 200px;" class="filter-item"
              @keyup.enter.native="toQuery"/>
      </el-form-item>
      <el-form-item label="设备区域">
    <el-select v-model="query.deviceArea" clearable placeholder="选择设备区域" class="filter-item" style="width: 130px">
      <el-option v-for="item in dict.area" :key="item.id" :label="item.areaName" :value="item.id"/>
    </el-select>
      </el-form-item>
      <el-button class="filter-item" size="mini" type="primary" @click="toQuery">搜索</el-button>
      <el-button class="filter-item" size="mini" type="info"  @click="toCancle">取消</el-button>
    </el-form>
    <eForm ref="form" :is-add="true" :dict="dict" :sup_this="sup_this"/>
  </div>
</template>

<script>
import eForm from './form'
export default {
  components: { eForm },
  props: {
    query: {
      type: Object,
      required: true
    },
    sup_this: {
      type: Object,
      default: null
    },
    dict: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
    }
  },
  methods: {
    toQuery() {
      this.sup_this.page = 0
      this.sup_this.init()
    },
    toCancle(){
         this.query.deviceName='';
         this.query.deviceArea='';
    }
  }
}
</script>
